package com.lrs.java.j2se_self.io;

import java.io.*;
public class TestFileWriter {
	public static void main(String[] args){
		FileReader fr = null;
		FileWriter fw = null;
		int b = 0;
		try{
			fr = new FileReader("D:\\javawork6.0\\eclipse Project\\eclipse3.3\\src\\io\\TestFileInputStream.java");
			fw = new FileWriter("D:\\javawork6.0\\eclipse Project\\eclipse3.3\\src\\io\\TestFileWriterCopy.java");
			
		}catch(FileNotFoundException e){
			e.printStackTrace();
			System.out.println("文件没找到!");
			System.exit(-1);
		}catch(IOException e){
			e.printStackTrace();
			System.out.println("文件复制错误");
			System.exit(-1);
		}
		try{
			while((b=fr.read())!=-1){
				fw.write(b);
			}
			fr.close();
			fw.close();
		}catch(IOException e){
			e.printStackTrace();
			System.out.println("文件复制错误!");
			System.exit(-1);
		}
		System.out.println("复制成功!");
	}
}
